﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using Majoopic.Service.Model;
using System.ComponentModel;
using System.Windows.Threading;

namespace Majoopic.WPFClient.ViewModels
{
    public abstract class BaseViewModel: INotifyPropertyChanged
    {
        public Mediator CurrentMediator
        {
            get
            {
                return Mediator.Current;
            }
        }

        public ServiceContext CurrentServiceContext
        {
            get
            {
                return this.CurrentMediator.CurrentServiceContext;
            }
        }

        private Dispatcher _UIDispatcher = Dispatcher.CurrentDispatcher;
        public Dispatcher UIDispatcher
        {
            get
            {
                return this._UIDispatcher;
            }
        }

        protected void OnPropertyChanged(string p)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(p));
            }
        }


        public event PropertyChangedEventHandler PropertyChanged;
    }
}
